var tableData = {
	url : ctp + "/attenRecordController/attenRecordsSearch.shtml",
	propertys : [ "ATTENCE_TIME","SIGN_TIME","NAME","JOBNO","MACHINE_CODE","PUNCH_TYPE","ADDRESS_NAME"],
	startLoad : function() {
		getListData(this);
	}
};

function searchData(curr) {
	setTagAndValue("form1", "curr", curr);
	tableData.startLoad();
}
$(document).ready(function() {
	$("#beginTime").val(setBeginTime());
	searchData();
	//getWorkerType();
});

function setBeginTime(){
	var d = new Date();
	var year = d.getFullYear() + "";
	var month = d.getMonth() + 1;
	var date = d.getDate();
	if(month < 10) month = "0" + month;
	if(date < 10) date = "0" + date;
	return year + "-" + month+"-"+date;
}


function attendanceDetails(recId) {
	location.href = ctp + "/attendanceController/attendanceDetails.shtml?recId="+recId;
}



function attenRecordUpdate(recId,num,sta) {
	if(sta != "STATUS3" && sta != "STATUS4"){
		layui.layer.open({
	        type: 2,
	        area: ['525px', '410px'],
	        title: "打卡时间修改",
	        fixed: false,
	        maxmin: false,
	        content: ctp + "/attenRecordController/attenRecordUpdate.shtml?recId="+recId+"&num="+num
	    });
	}
	
	
}

//导出系统用户
function exportConfirm(recId){
	var formSerialize =$("#form1").serialize();
	jconfirm("exportData('"+formSerialize+"')","确认要导出考勤数据吗？");	
}
function exportData(formSerialize){
	location.href=ctp+"/attenRecordController/exportAttendance.shtml?"+formSerialize;
}


function getWorkerType() {
	$.ajax({
		url : ctp + "/sysdictController/getDictListByType.shtml",
		data : {
			dicType : 'WORKER_TP'
		},
		type : "POST",
		cache : false,
		dataType : "json",
		success : function(data) {
			var list = data.list;
			var $str = '';
			$str += '<option value="">--请选择--</option>';
			for (var i = 0; i < list.length; i++) {
				var l = list[i];
				$str += '<option value="' + l.rec_value + '">' + l.rec_value
						+ '</option>';
			}
			$('#workeType').html($str);
		}
	});
}

